import React from "react";

interface StateType {
  count: number;
}

export class Button extends React.Component<{}, StateType> {
  constructor(props: any) {
    super(props);
    this.state = {
      count: 0,
    };
  }

  upddateCount = () => {
    this.setState(
      (prevState: any) => {
        return {
          count: prevState.count + 1,
        };
      },
      () => {
        console.log(this.state.count);
      }
    );
  };

  render() {
    return <button onClick={this.upddateCount}>{this.state.count}</button>;
  }
}
